<?php
namespace app\admin\controller;
use think\Controller;

class About extends Base
{
  public function index(){
    $data = db('about')->find();
    $this->assign('data',$data);
    return view();
  }
  public function contact(){
    $data = db('contact')->find();
    $this->assign('data',$data);
    return view();
  }
  public function edit_about(){
    $msg['content'] = input('content');
    // p($msg['content']);
    $ret  = db('about')->where(array('id'=>'0'))->update($msg);
    if($ret)
      return $this->success('更新成功');
    else
      return $this->error('更新失败，请联系管理员');
  }
  public function edit_contact(){
    $msg['content'] = input('content');
    // p($msg['content']);
    $ret  = db('contact')->where(array('id'=>'0'))->update($msg);
    if($ret)
      return $this->success('更新成功');
    else
      return $this->error('更新失败，请联系管理员');
  }
}
